package day017.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class StreamDemo6 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i <= 10; i++) {
            list.add(i);
        }

        list.add(10);
        list.add(10);
        list.add(10);
        list.add(10);
        list.add(10);

        List<Integer> list2 = list.stream().filter(num -> num % 2 == 0).
                collect(Collectors.toList());
        System.out.println(list2);

        Set<Integer> set = list.stream().filter(num -> num % 2 == 0).
                collect(Collectors.toSet());
        System.out.println(set);
    }
}
